package com.chinaunicom.emergency.repository;

import com.chinaunicom.emergency.model.Permissions;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * @author liliang
 * @date 2019-12-13
 * 资源权限
 */
public interface PermissionsRepository extends JpaRepository<Permissions,String>, JpaSpecificationExecutor {

    List<Permissions> findByParentIdIsNullAndIsSoftDelOrderByPidAsc(Integer isSoftDel);

    List<Permissions> findAllByIsSoftDel(Integer isSoftDel);

    List<Permissions> findByParentIdAndIsSoftDelOrderByPidAsc(String parentId, Integer isSoftDel);

    List<Permissions> findByParentIdAndAppkeyAndPermissionsCodeAndIsSoftDel(String parentId, String appKey, String permissionCode, Integer isSoftDel);

    Permissions findByPidAndIsSoftDel(String pid, Integer isSoftDel);
}
